#pragma once

#include<vector>
#include<iostream>
#include<time.h>

typedef void (*task) ();

void UpLoad()
{
    std::cout <<"This is a upload task!" << std::endl;
}

void Load()
{
    std::cout << "This is a load task!" << std::endl;
}

void DownLoad()
{
    std::cout << "This is a download task!" << std::endl;
}

class Task_Manager
{
    public:
    Task_Manager()
    {
        srand(time(nullptr));
    }

    void Register(task t)
    {
        _tasks.push_back(t);
    }

    int Code()
    {
        return rand() % _tasks.size();
    }

    void Execute(int code)
    {
        if(code >= 0 && code < _tasks.size())
        {
            _tasks[code];
        }
    }
    ~Task_Manager()
    {

    }

    private:
    std::vector<task> _tasks;
};

